package com.example.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

@Data
public class TogetherPerson {
    @TableId(type = IdType.AUTO)
    private Integer togetherPersonId;
    private String primaryPerson;
    private String primaryPersonNumber;
    private String togetherPersons;
    public List<String> getTogetherPersons() {
        if (togetherPersons == null) {
            return Collections.emptyList();
        }
        return Collections.unmodifiableList(Arrays.asList(togetherPersons.split(",")));
    }

    public void setTogetherPersons(List<String> TogetherPersons) {
        if (TogetherPersons != null) {
            this.togetherPersons = String.join(",", TogetherPersons);
        } else {
            this.togetherPersons = null;
        }
    }
}
